4、R格式

题目 R格式

image-cb07520f

思路分析

高精度 太麻烦所以打算后面写 先交了个一定有分的解法

但是后面并没有剩出时间来

代码实现

#include<bits/stdc++.h>

using namespace std;

#define endl '\n'

//R格式:

//  把 大于0的 浮点数d (记得开double 运算记得乘上1.0)

//  乘上 2^n (pow?快速幂?)

//  四舍五入到最近的整数 (round())

// n=2 d=3.14

//round(d*pow(2,n))

//d长度1024 那就是有1024位 靠 高精度 还是浮点数 寄 拿一半分

//尽可能往大的取 这个浮点数大于0 尝试用无符号 unsigned long double; ……浮点数好像不行

//先交了后面回头优化

typedef long double LD;

int main()

{

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	LD n,d;

//	n=2,d=3.14;

	cin>>n>>d;

	cout<<round(d*pow(2,n));

	return 0;

}

同类题型

视频讲解


⬅️ 3、好数 🏠 00-刷题理模型 ➡️ 5、宝石组合